package cn.sunflower.exam.service.impl;

import cn.sunflower.exam.entity.Score;
import cn.sunflower.exam.exception.EmpNotLegal;
import cn.sunflower.exam.mapper.ScoreMapper;
import cn.sunflower.exam.seivice.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhanglf
 */
@Service
public class ScoreServiceImpl implements ScoreService {

    @Autowired
    private ScoreMapper scoreMapper;

    @Override
    public Score findScoreByEmpId(String empId, String type) throws EmpNotLegal {
        if(empId ==null){
            throw new EmpNotLegal();
        }
       return scoreMapper.findScoreByEmpIdAndType(empId,type);
    }

    @Override
    public List<Score> findAllScoreByEmpId(String empId, String type) throws EmpNotLegal {
        if(empId ==null){
            throw new EmpNotLegal();
        }
       return scoreMapper.findAllScoreByEmpIdAndType(empId,type);
    }
}
